<html>
<head><meta charset="utf-8"><title>Experiments with (faster) async trait objects · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Experiments.20with.20(faster).20async.20trait.20objects.html">Experiments with (faster) async trait objects</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="209947761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Experiments%20with%20%28faster%29%20async%20trait%20objects/near/209947761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthias247 <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Experiments.20with.20(faster).20async.20trait.20objects.html#209947761">(Sep 13 2020 at 20:12)</a>:</h4>
<p>Since this might also be interesting to this group, I will also share it here: <a href="https://internals.rust-lang.org/t/async-traits-the-less-dynamic-allocations-edition/13048/2">https://internals.rust-lang.org/t/async-traits-the-less-dynamic-allocations-edition/13048/2</a></p>



<a name="209947934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Experiments%20with%20%28faster%29%20async%20trait%20objects/near/209947934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthias247 <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Experiments.20with.20(faster).20async.20trait.20objects.html#209947934">(Sep 13 2020 at 20:16)</a>:</h4>
<p>If this finds some wider interest, I think <a href="https://github.com/Matthias247/async_trait_experiments/blob/master/src/dynamic_future.rs">DynamicFuture</a> could be a thing that could be worthwhile to include in <code>core::future</code>.  It allows to make type erased futures which use different backing storage mechansism interoperable through the same mechansim that we already use for <code>Waker</code>s. </p>
<p>But there is obviously no urgent need for it - this could be a mini-library too until we understand the use-cases and demand better.</p>



<a name="210057581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/Experiments%20with%20%28faster%29%20async%20trait%20objects/near/210057581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sam Sartor <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/Experiments.20with.20(faster).20async.20trait.20objects.html#210057581">(Sep 14 2020 at 20:18)</a>:</h4>
<p>I put this in the internals too, but this feature could have a kinda interesting relationship with procedural vtables (and also with &amp;move or equivalent). In fact, as far as I can tell, <code>DynamicFuture</code> is exactly a <code>&amp;move dyn Future</code> with a slightly custom vtable. <a href="https://gitlab.com/-/snippets/2013937">I sketched out a version of it</a> that I'm interested to hear your take on.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>